<template>
  <div>

<!-- 搜索部分 -->
    <el-row>
      <el-col :span="18" :offset="5">
        <el-form :inline="true"  class="demo-form-inline">
  <el-form-item label="核心企业">
    <el-input  placeholder="请输入企业名称" v-model="ename"></el-input>
  </el-form-item>
  <el-form-item label="融资企业">
    <el-input  placeholder="请输入企业名称" v-model="fname"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="dofind()">查询</el-button>
  </el-form-item>
  </el-form>
      </el-col>
    </el-row>

<!-- 表格部分 -->
    <el-row>
      <el-col :span="19" :offset="2">
        <el-table
    :data="tableData"
    stripe
    border
    style="width: 100%">

    <el-table-column
      type="index"
      width="90"
      align="center"
      label="序号">
    </el-table-column>

    <el-table-column
      prop="coreName"
      label="核心企业"
      width="180">
    </el-table-column>

    <el-table-column
      prop="finaceName"
      label="融资企业"
      width="180">
    </el-table-column>

    <el-table-column
      prop="creatTime"
      label="放款时间"
      width="180">
    </el-table-column>

    <el-table-column
      prop="fianceMoney"
      label="融资金额"
      width="180">
    </el-table-column>

    <el-table-column
      prop="interestMoney"
      label="利息总额"
      width="180">
    </el-table-column>

    </el-table>
      </el-col>
    </el-row>

<!-- 分页部分 -->
    <el-row>
      <el-col :span="8" :offset="8">
        <el-pagination
    background
    :page-sizes="[1, 2, 3, 4]"
    :page-size="pageSize"
    :current-page="pageNumber"
    layout="total, sizes,prev, pager, next"
    @prev-click="prevPage"
    @next-click="nextPage"
    @size-change="sizeChange"
    @current-change="currentChange"
    :total="total">
  </el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
    data(){
        return{
            fname:'',
            ename:'',
            tableData:[],
            pageSize:2,
            pageNumber:1,
            total:0,

        }
    },
    methods:{
 
        queryloan(){
            let request={};
            request.pageNum = this.pageNumber;
            request.pageSize = this.pageSize;
            let data = {};
            data.finaceName = this.fname;
            data.coreName = this.ename;
            request.data = data;
            this.$axios.post('api/loan/list',request,{headers:{'jwt':localStorage.getItem('jwt')}})
            .then(res =>{
                console.log(res.data)
                let pageData = res.data.data;
                this.tableData = pageData.list;
                this.pageNumber = pageData.pageNum;
                this.pageSize = pageData.pageSize;
                this.total = pageData.total;
            })
        },
        dofind(){
            console.log("融资企业："+this.fname)
            console.log("核心企业："+this.ename)
            this.pageNumber=1
            this.queryloan();
        },
        prevPage(val){
            this.pageNumber = val
            this.queryloan();
        },
        nextPage(val){
            this.pageNumber = val
            this.queryloan();
        },
        sizeChange(val){
            this.pageSize = val
             this.pageNumber = 1;
             this.queryloan();
        },
        currentChange(val){
            this.pageNumber = val
            this.queryloan();
        },


    },
    created(){
        this.queryloan();
    }

}
</script>

<style>

</style>